var $ = getApp(), methods = require("../methods.js");
Page(Object.assign({}, methods, {
	data: {
		sharepic: '',
		shopset: [],
		userinfo: []
	},
	_onLoad: function (options) {
		var that = this;
		$.get('agent/poster', {}, function(res) {
			if(res.status==0){
				$.alert(res.msg)
			}
			that.setData(res)
		},'海报生成中');
	},
	onShareAppMessage: function (res) {
		var that = this
		var scene = this.data.userinfo.id;
		var imageUrl = this.data.shopset.shopbanner;
		var title = this.data.shopset.shopname;
		return {
			title: title,
			path: that.data.indexurl+'?scene=' + scene,
			imageUrl: imageUrl,
			success: function (res) {
				// 转发成功
			},
			fail: function (res) {
				// 转发失败
			}
		}
	},
	changeposter:function(e){
		var that = this
		var posterid = e.currentTarget.dataset.id
		$.get('agent/poster', {posterid:posterid}, function(res) {
			if(res.status==0){
				$.alert(res.msg)
			}
			that.setData(res)
		},'海报生成中');
	}
}))